/*
 * @Author: ChaiHongJun
 * @Date: 2021-07-08 15:32:51
 * @LastEditors: ChaiHongJun
 * @LastEditTime: 2021-07-15 10:12:46
 * @version:
 * @Description: 用户模块请求
 */

import api from "@/api/axios/index.js";

/**
 * @name:
 * @param {data} {手机号，验证码}
 * @return {*}
 */

// 登录
export const login = (data) => api.post("/app/v1_0/authorizations", data);

// 获取短信验证码

export const getSMS = (mobile) => api.get(`/app/v1_0/sms/codes/${mobile}`);

// 获取用户信息
// auth:header["Authorization"]
export const getUserInfo = () =>
  // api.get(`/app/v1_0/user`, { headers: { Authorization: `Bearer ${token}` } });
  api.get(`/app/v1_0/user`);


// 获取用户频道列表
export const getUserChannels = () => api.get(`/app/v1_0/user/channels`)

//获取用户频道新闻
export const getArticles = (channel_id, timestamp, with_top) =>
  api.get(
    `/app/v1_1/articles?channel_id=${channel_id}&timestamp=${timestamp}&with_top=${with_top}`
  );
